package com.lifetime.controller;

import com.lifetime.service.CharacterService;
import com.lifetime.service.RecoveryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@Controller
public class CharacterController {
    @Autowired
    CharacterService characterService;

    @GetMapping("character")
    public Object character(HttpServletRequest request) {
        int userId = Integer.parseInt(request.getSession().getAttribute("userId").toString());
        int CharacterID = Integer.parseInt(request.getParameter("characterID"));
        // int userId=1;
        if (userId == 0 || CharacterID == 0) {
            return null;
        }
        return characterService.getCharacterPic(userId, CharacterID);
    }

}
